package com.lesliefang;

/**
 * @author fanglin
 * @since 2024-08-22
 */
public class Main {
    public static void main(String[] args) {
        if (args.length < 3) {
            System.out.println("input at least 3 parameters");
            return;
        }
        // java -jar passwordtool-2.0.jar  decrypt materialDirPath  111111  2222
        // arg[0]  encrypt or decrypt
        // arg[1] materialDirPath
        // arg[2..n] password
        if (args[0].equals("encrypt")) {
            for (int i = 2; i < args.length; i++) {
                try {
                    System.out.println(SignUtil.getEncryptPassword(args[1], args[i]));
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }
        } else if (args[0].equals("decrypt")) {
            for (int i = 2; i < args.length; i++) {
                try {
                    System.out.println(SignUtil.getDecryptPassword(args[1], args[i]));
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }
        } else {
            System.out.println("parameter error: arg[0] is  encrypt or decrypt");
        }
    }
}